From 4e2631d75c44e7f22df42129f7233e7f65bf9070 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 9 Feb 2006 18:35:15 +0100 Subject: [PATCH] Delete old 'shortcut' function __shadow_status() and rename the core function ___shadow_status() to take its place. The 'fast path quick test' was ridiculously bloated and didn't work for PGT_fl1_shadow pages. Signed-off-by: Keir Fraser --- xen/arch/x86/shadow.c | 2 +- xen/include/asm-x86/shadow.h | 52 ++++-------------------------------- xen/include/xen/perfc_defn.h | 2 +- 3 files changed, 7 insertions(+), 49 deletions(-) diff --git a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c index ffa811e667..c748bbde0f 100644 --- a/xen/arch/x86/shadow.c +++ b/xen/arch/x86/shadow.c @@ -3256,7 +3256,7 @@ static inline int l2e_rw_fault( if ( !__shadow_get_l2e(v, va, &sl2e) ) sl2e = l2e_empty(); - l1_mfn = ___shadow_status(d, start_gpfn | nx, PGT_fl1_shadow); + l1_mfn = __shadow_status(d, start_gpfn | nx, PGT_fl1_shadow); /* Check the corresponding l2e */ if (l1_mfn) { diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index 773e306f99..3fff8e9be5 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -1179,19 +1179,21 @@ static inline struct shadow_status *hash_bucket( * its mfn). * It returns the shadow's mfn, or zero if it doesn't exist. */ - -static inline unsigned long ___shadow_status( +static inline unsigned long __shadow_status( struct domain *d, unsigned long gpfn, unsigned long stype) { struct shadow_status *p, *x, *head; unsigned long key = gpfn | stype; + ASSERT(shadow_lock_is_acquired(d)); + ASSERT(gpfn == (gpfn & PGT_mfn_mask)); + ASSERT(stype && !(stype & ~PGT_type_mask)); + perfc_incrc(shadow_status_calls); x = head = hash_bucket(d, gpfn); p = NULL; - //SH_VVLOG("lookup gpfn=%08x type=%08x bucket=%p", gpfn, stype, x); shadow_audit(d, 0); do @@ -1221,7 +1223,6 @@ static inline unsigned long ___shadow_status( perfc_incrc(shadow_status_hit_head); } - //SH_VVLOG("lookup gpfn=%p => status=%p", key, head->smfn); return head->smfn; } @@ -1230,53 +1231,10 @@ static inline unsigned long ___shadow_status( } while ( x != NULL ); - //SH_VVLOG("lookup gpfn=%p => status=0", key); perfc_incrc(shadow_status_miss); return 0; } -static inline unsigned long __shadow_status( - struct domain *d, unsigned long gpfn, unsigned long stype) -{ - unsigned long mfn = ((current->domain == d) - ? gmfn_to_mfn(d, gpfn) - : INVALID_MFN); - - ASSERT(shadow_lock_is_acquired(d)); - ASSERT(gpfn == (gpfn & PGT_mfn_mask)); - ASSERT(stype && !(stype & ~PGT_type_mask)); - - if ( VALID_MFN(mfn) && mfn_valid(mfn) && - (stype != PGT_writable_pred) && - ((stype == PGT_snapshot) - ? !mfn_out_of_sync(mfn) - : !mfn_is_page_table(mfn)) ) - { - perfc_incrc(shadow_status_shortcut); -#ifndef NDEBUG - if ( ___shadow_status(d, gpfn, stype) != 0 ) - { - printk("d->id=%d gpfn=%lx mfn=%lx stype=%lx c=%x t=%" PRtype_info " " - "mfn_out_of_sync(mfn)=%d mfn_is_page_table(mfn)=%d\n", - d->domain_id, gpfn, mfn, stype, - mfn_to_page(mfn)->count_info, - mfn_to_page(mfn)->u.inuse.type_info, - mfn_out_of_sync(mfn), mfn_is_page_table(mfn)); - BUG(); - } - - // Undo the affects of the above call to ___shadow_status()'s perf - // counters, since that call is really just part of an assertion. - // - perfc_decrc(shadow_status_calls); - perfc_decrc(shadow_status_miss); -#endif - return 0; - } - - return ___shadow_status(d, gpfn, stype); -} - /* * Not clear if pull-to-front is worth while for this or not, * as it generally needs to scan the entire bucket anyway. diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h index 05a4b106ae..d991b8ef49 100644 --- a/xen/include/xen/perfc_defn.h +++ b/xen/include/xen/perfc_defn.h @@ -86,7 +86,7 @@ PERFCOUNTER_CPU(shadow_invlpg_faults, "shadow_invlpg's get_user faulted") PERFCOUNTER_CPU(unshadow_l2_count, "unpinned L2 count") PERFCOUNTER_CPU(shadow_status_shortcut, "fastpath miss on shadow cache") -PERFCOUNTER_CPU(shadow_status_calls, "calls to ___shadow_status") +PERFCOUNTER_CPU(shadow_status_calls, "calls to shadow_status") PERFCOUNTER_CPU(shadow_status_miss, "missed shadow cache") PERFCOUNTER_CPU(shadow_status_hit_head, "hits on head of bucket") PERFCOUNTER_CPU(shadow_max_type, "calls to shadow_max_type") -- 2.30.2